<template>
  <div class="login">
    <div class="Popup">
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-input
          class="username"
          v-model="ruleForm.name"
          placeholder="请输入用户名"
        ></el-input>
        <el-input
          class="password"
          v-model="ruleForm.pwd"
          placeholder="请输入密码"
        ></el-input>
        <div class="rember">
          <el-checkbox label="记住用户名和密码" name="type"></el-checkbox>
          <span>忘记密码？</span>
        </div>
        <el-button type="primary" @click="submitForm('ruleForm')"
          >登录</el-button
        >
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        name: "",
        pwd: "",
      },
      rules: {
        name: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
          { min: 2, max: 5, message: "长度在2到5个字符", trigger: "blur" },
        ],
        pwd: [{ required: true, message: "请输入密码", trigger: "blur" }],
      },
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  },
};
</script>


<style lang="less" scoped>
.login {
  width: 100%;
  height: 100%;
  background: url("../assets/images/homepage-photo_03.png") no-repeat center center;
  background-size: cover;
  position: relative;
  .Popup {
    width: 520px;
    height: 406px;
    padding: 105px 78px 0 78px;
    box-sizing: border-box;
    text-align: left;
    background: #fff;
    position: absolute;
    top: 50%;
    right: 114px;
    transform: translateY(-50%);
    span {
      color: #c0c0c0;
    }
    .rember {
      display: flex;
      justify-content: space-between;
    }
    .username {
      margin-bottom: 28px;
    }
    .password {
      margin-bottom: 13px;
    }
    /deep/.el-input__inner {
      color: #c0c0c0;
      height: 40px;
      width: 100%;
      line-height: 40px;
      box-sizing: border-box;
      border: 1px solid #c0c0c0;
      border-radius: 0px;
      padding: 0 15px 0 48px;
    }
    /deep/.el-checkbox {
      color: #c0c0c0;
      display: inline-block;
      text-align: right;
    }
    /deep/.el-checkbox__inner {
      height: 15px;
      width: 15px;
      border-radius: 0px;
      border: 1px solid #c0c0c0;
    }
    .el-button {
      height: 38px;
      width: 100%;
      font-size: 18px;
      font-weight: bold;
      display: block;
      margin-top: 52px;
      border-radius: 0px;
      background: linear-gradient(to right, #6da3f5 0%, #5d73f2 50%);
    }
  }
}
</style>